Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix webgpu delay load test #23157

Merged
merged 3 commits into from
Dec 20, 2024
Merged

fix webgpu delay load test #23157

merged 3 commits into from
Dec 20, 2024

Conversation

fs-eire
Copy link
Contributor

@fs-eire fs-eire commented Dec 19, 2024

Description

This change fixes the WebGPU delay load test.

Fix UB in macro

The following C++ code outputs 2, 1 in MSVC, while it outputs 1, 1 in GCC:

#include <iostream>

#define A 1
#define B 1

#define ENABLE defined(A) && defined(B)

#if ENABLE
int x = 1;
#else
int x = 2;
#endif

#if defined(A) && defined(B)
int y = 1;
#else
int y = 2;
#endif

int main()
{
    std::cout << x << ", " << y << "\n";
}

Clang reports macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined].

Fix condition of build option onnxruntime_ENABLE_DELAY_LOADING_WIN_DLLS

Delay load is explicitly disabled when python binding is being built. modifies the condition.

@fs-eire fs-eire force-pushed the fs-eire/fix-delay-load-test branch from 69056fe to e512048 Compare December 20, 2024 04:51
@fs-eire fs-eire merged commit 6806174 into main Dec 20, 2024
96 checks passed
@fs-eire fs-eire deleted the fs-eire/fix-delay-load-test branch December 20, 2024 21:37
tarekziade pushed a commit to tarekziade/onnxruntime that referenced this pull request Jan 10, 2025
### Description

This change fixes the WebGPU delay load test.


<details>
<summary>Fix UB in macro</summary>

The following C++ code outputs `2, 1` in MSVC, while it outputs `1, 1`
in GCC:

```c++
#include <iostream>

#define A 1
#define B 1

#define ENABLE defined(A) && defined(B)

#if ENABLE
int x = 1;
#else
int x = 2;
#endif

#if defined(A) && defined(B)
int y = 1;
#else
int y = 2;
#endif

int main()
{
    std::cout << x << ", " << y << "\n";
}
```

Clang reports `macro expansion producing 'defined' has undefined
behavior [-Wexpansion-to-defined]`.

</details>

<details>
<summary>Fix condition of build option
onnxruntime_ENABLE_DELAY_LOADING_WIN_DLLS</summary>

Delay load is explicitly disabled when python binding is being built.
modifies the condition.

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants